package scan;

import java.io.File;

/**
 * Variables shared by various classes
 * <p/>
 * Copyright 2006-2012 Thierry Salmon. All rights reserved. <a
 * href="http://tinyscan.sourceforge.net">http://tinyscan.sourceforge.net</a>
 * 
 * @author Thierry Salmon
 */
public class SharedData {

	private static boolean checksum;
	private static boolean depthLimit = false;
	private static boolean filesAndFolders = true;
	private static boolean skipFileData;
	private static boolean utf8 = false;
	private static String node;
	private static int depth = 0;

	protected static final String[] columnsHeaders = { "id", "path", "name",
			"ext", "folder", "type", "sizemb", "sizeb", "items", "date",
			"time", "depth", "fplength", "csum", "duplicate", "scandate",
			"scantime", "node" }; // this should match the table
									// model, the columns numbers,
									// the create table and the
									// print to file

	public String getNode() {
		return node;
	}

	public boolean getUTF8() {
		return utf8;
	}

	public boolean checksum() {
		return checksum;
	}

	public boolean depthLimit() {
		return depthLimit;
	}

	public boolean filesAndFolders() {
		return filesAndFolders;
	}

	public boolean skipFileData() {
		return skipFileData;
	}

	public int getDepth() {
		return depth;
	}

	public void setFilesAndFolders(boolean filesAndFolders) {
		SharedData.filesAndFolders = filesAndFolders;
	}

	public void setDepth(int depth) {
		SharedData.depth = depth;
		depthLimit = true;
	}

	public void setNode(File outputFile) {
		int indexSeparator = 0;
		indexSeparator = outputFile.toString().lastIndexOf(File.separatorChar);

		try {
			node = outputFile.toString().substring(indexSeparator + 1,
					outputFile.toString().lastIndexOf("."));
		} catch (java.lang.StringIndexOutOfBoundsException e) {
			node = outputFile.toString().substring(indexSeparator + 1);
		}
	}

	public void setSkipFileData(boolean skipFileData) {
		SharedData.skipFileData = skipFileData;
	}

	public void setChecksum(boolean checksum) {
		SharedData.checksum = checksum;
	}

	public void setUTF8(boolean utf8) {
		SharedData.utf8 = utf8;
	}
}
